<?php
include_once("../../../common/modules/checkA.php");
include_once("../../../../config.php");
include_once("../controller/detail-list-register.php");
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <?php include ROOT_PATH_.'/controller/common/modules/head.php'; ?>
    <?php include 'modules/head.php'; ?>
</head>

<body>

<div id="topbar">
    <?php include ROOT_PATH_.'/controller/common/modules/topbar.php'; ?>
</div>

<div id="container" class="<? echo $system_part ?>">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_.'/controller/common/modules/sidebar.php'; ?>
        </div>


<div id="content" class="layui-form">

	<h1> 活动 "<?php echo $info['theme']?>" 报名列表 </h1>

    <div>
        活动id:<b><?php echo $info['nid']?></b> &nbsp;&nbsp; | &nbsp;&nbsp;
        标签:<b><?php echo $info['tag']?></b> &nbsp;&nbsp; | &nbsp;&nbsp;
        活动价格:<b><?php echo $info['price']?></b> &nbsp;&nbsp; | &nbsp;&nbsp;
        报名开始时间:<b><?php echo $info['apply_starttime']?></b> &nbsp;&nbsp; | &nbsp;&nbsp;
        报名结束时间:<b><?php echo $info['apply_endtime']?></b> &nbsp;&nbsp; | &nbsp;&nbsp;
        活动开始时间:<b><?php echo $info['starttime']?></b> &nbsp;&nbsp; | &nbsp;&nbsp;
        活动结束时间:<b><?php echo $info['endtime']?></b>
    </div>

    <br/>
    <div class="select-box layui-form">
        <form action="detail-list-register.php" >

            <div class="layui-form-item">
                <label class="layui-form-label">关键词</label>
                <div class="layui-input-block">
                    <input type="text" name="select_keywords" placeholder="可搜索报名人名" autocomplete="off" class="layui-input" value="<? echo $_REQUEST['select_keywords']?>" >
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">报名时间</label>

                <div class="layui-input-block">
                    <input type="text" name="select_startday" placeholder="请输入开始时间" autocomplete="off" class="layui-input"  onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" style="float: left; width: 112px" value="<?if($_REQUEST['select_startday']){echo $_REQUEST['select_startday'] ;} ?>" >

                    <span style="float: left;margin: 0 4px; line-height: 30px;">-</span>


                    <input type="text" name="select_endday" placeholder="请输入结束时间" autocomplete="off" class="layui-input" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"  style="float: left; width:112px" value="<?if($_REQUEST['select_endday']){echo $_REQUEST['select_endday'] ;} ?>"  >


                    <input type="hidden" name="sys_part"  value="activity" >
                    <input type="hidden" name="nid"  value="<?php echo $nid?>" >


                </div>


            </div>
            <button class="layui-btn" name="search"><i class="layui-icon">&#xe615;</i> 查找</button>
         <!--   <input class="layui-btn" type="submit" value="导出报名" name="search">-->
            <a class="layui-btn white" href="<?echo $domain?>/controlbase/activity/detail-list-register.php?sys_part=activity" ><i class="layui-icon">&#x1006;</i> 重置</a>

        </form>

        <br class="clearfloat"/>
    </div>


    <div class="flash_box">
        退款说明：
        1、活动所有状态下，后台都可以操作退款，退款金额自定（可全款或小额）；
        2、退款只能操作一次，请谨慎操作。
        3、操作流程【输入金额-点击退款-退款成功】
    </div>

    <div class="tips">手动流局不自动退款，需要人手操作。</div>


<!-- 用$system_part .list_boxes来控制来到确认板块信息显示-->
<div class="list-box">

<div class="list-boxes">



<?php

if ($detailnum == 0) {
    echo "数据添加中";
}

?>




<table class="layui-table">
  <colgroup>
    <col width="60">
    <col width="260">
	<col width="260">
	<col width="300">
    <col>
      <col width="200">


  </colgroup>
  <thead>
    <tr>
      <th>序号</th>
      <th>报名人名字</th>
      <th>报名人号码</th>
      <th>报名时间</th>
      <th>性别</th>
      <th>操作</th>

    </tr>
  </thead>
  <tbody>


	<?php

	for ($i = 0; $i < $detailnum; $i++) {
    ?>
    <tr id="item<?echo $detail[$i]['nid']?>" >
      <td><? echo $i+1+$plate['page_list_num']*($nowpageid-1) ?></td>
      <td><img src="<? echo $detail[$i]['headimgurl']?>" width="15" height="15"> <? echo $detail[$i]['nickname']?></td>
      <td><? echo $detail[$i]['phone']?></td>
      <td><? echo date("Y-m-d h:i",strtotime($detail[$i]['add_date']))?></td>
      <td><? echo $detail[$i]['sex'] == 1 ? '男' : '女'?></td>
        <td>
          <?php
          if($detail[$i]['is_delete'] == 0){
          ?>

           <?if($detail[$i]['order_info']['refund_price']){?>
              <a class="layui-btn layui-btn-sm" href="javascript:;" onclick="refundOrder(<?echo $detail[$i]['nid']?>)">退款</a>
          <?}else{?>
              <a class="layui-btn layui-btn-sm" href="javascript:;" onclick="deletejoin(<?echo $detail[$i]['nid']?>)">取消</a>
          <?}?>


          <input type="text" style="display: inline-block;width: 90px;padding: 0 0 0 10px;height: 24px;" id="price<?echo $detail[$i]['nid']?>"  value="<?echo $detail[$i]['order_info']['pay_price']?>"/>
          <?php }
          else{
          ?>
              已退款 <?php echo $detail[$i]['order_info']['refund_price'];?>
          <?php }?>

        </td>



    </tr>

        <?if(count($detail[$i]['h5apply'])>0){?>
    <tr>
        <td colspan="1"></td>
         <td colspan="5">
             <?if($detail[$i]['h5apply']['name']){?><span class="layui-btn layui-btn-xs"> <? echo $detail[$i]['h5apply']['name']?></span><?}?>
             <?if($detail[$i]['h5apply']['idnumber']){?><span class="layui-btn layui-btn-xs"> <? echo $detail[$i]['h5apply']['idnumber']?></span><?}?>
             <?if($detail[$i]['h5apply']['gender']){?><span class="layui-btn layui-btn-xs"> <? echo $detail[$i]['h5apply']['gender']?></span><?}?>
             <?if($detail[$i]['h5apply']['team']){?><span class="layui-btn layui-btn-xs"> <? echo $detail[$i]['h5apply']['team']?></span><?}?>
             <?if($detail[$i]['h5apply']['groups']){?><span class="layui-btn layui-btn-xs"> <? echo $detail[$i]['h5apply']['groups']?></span><?}?>
             <?if($detail[$i]['h5apply']['unit']){?><span class="layui-btn layui-btn-xs"> <? echo $detail[$i]['h5apply']['unit']?></span><?}?>
             <?if($detail[$i]['h5apply']['reamrk']){?><span class="layui-btn layui-btn-xs"> <? echo $detail[$i]['h5apply']['reamrk']?></span><?}?>
             </td>
    </tr>
        <?}?>

  <?php

}
?>


  </tbody>
</table>






</div>


</div>


<!--list-box end-->
</div>

<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>


<script>




    function refundOrder(nid)
    {
        pay_price = $('#price'+nid).val()
        if(confirm('确定退款吗？ 退款金额为：￥'+pay_price))
        {

            $.ajax({
                type:"POST",
                url:"../controller/ajax_controller.php?act=refundOrder",
                dateType:"json",
                data:{"nid":nid,"price":pay_price},
                dataType:"json",
                beforeSend:
                    function () {
                        layer.msg('正在检查状态中');
                        console.log("发送前");
                    },
                success:
                    function(data){
                        layer.msg(data.info);
                        console.log(data.info);
                        if(data.status == 300)
                        {
                            alert("退款失败，检查");
                        }
                        else{
                            location.reload();
                        }

                    }
            })

        }

    }
</script>
<script>

    function deletejoin(nid){
        if(confirm('确定取消该用户报名吗?'))
        {

            $.ajax({
                type:"POST",
                url:"../controller/model/delete_join.php",
                dateType:"json",
                data:{"nid":nid},
                dataType:"json",
                beforeSend:
                    function () {
                        layer.msg('正在检查状态中');
                        console.log("发送前");
                    },
                success:
                    function(data){
                        layer.msg(data.info);
                        console.log(data.info);
                        if(data.status == 300)
                        {
                            alert("退款失败，检查");
                        }
                        else{
                            location.reload();
                        }

                    }
            })

        }

    }



</script>

<?php include ROOT_PATH_.'/controller/common/modules/deletebar.php'; ?>
<!--删除box end-->

<?php include ROOT_PATH_."/controller/common/modules/footer.php"; ?>
 </body>
</html>
